package com.lmabbe.common.datasources.listener;

import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;

/**
 * @author lmabbe
 */
@Component
public class FlushDbListener extends FlushBbEventMessageListener {

    public FlushDbListener(RedisMessageListenerContainer listenerContainer) {
        super(listenerContainer);
    }


    @Override
    public void onMessage(Message message, byte[] pattern) {
        byte[] body = message.getBody();// 建议使用: valueSerializer
        byte[] channel = message.getChannel();
        System.out.print("onMessage >> ");
        System.out.println(String.format("channel: %s, body: %s, bytes: %s"
                , new String(channel), new String(body), new String(pattern)));
    }
}
